#include <riscv/func_stack.h>

namespace riscv {
  FuncStack::FuncStack() {
    this->alloc_size = 0;
  }

  void FuncStack::add_alloc_size(unsigned int size) {
    this->alloc_size += size;
  }

  void FuncStack::add_stored_reg(Reg reg) {
    this->stored_regs.insert(reg);
  }

  std::set<Reg> FuncStack::get_stored_regs() {
    return this->stored_regs;
  }

  unsigned int FuncStack::all_alloc_size() {
    return this->alloc_size;
  }

  unsigned int FuncStack::all_size() {
    return this->alloc_size + (this->stored_regs.size() * 8);
  }
}
